Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added warning to nodes selector if nothing was matched #2343

Merged
merged 4 commits into from
May 7, 2020

Conversation

Raalsky
Copy link
Contributor

@Raalsky Raalsky commented Apr 19, 2020

resolves #2115

Description

Added warning (or error when --warn-error provided) when resource selector fails due to lack of resources for example when the incorrect model name was provided.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label Apr 19, 2020
@Raalsky Raalsky changed the title Added warning to nodes selector if nothing was matched WIP: Added warning to nodes selector if nothing was matched Apr 19, 2020
@drewbanin drewbanin requested a review from beckjake April 20, 2020 19:56
@drewbanin
Copy link
Contributor

Thanks for opening this PR @Raalsky! I dropped one copy request inline + adding @beckjake to review :)

@beckjake
Copy link
Contributor

This will trigger a warning on any project that doesn't have sources (that's what the tests are failing about). I think this is a good feature, but I think we're going to have to change a bit more about how node selection works for this to function.

I think we could change get_selected and select_nodes to handle this case a bit more carefully: instead of calling coalesce in get_selected, do the replacement in select_nodes and preserve the initial value. If it's None, skip the check.

@Raalsky Raalsky force-pushed the warn-nothing-selected branch 2 times, most recently from 916bcc5 to 494c133 Compare May 7, 2020 14:49
@cla-bot
Copy link

cla-bot bot commented May 7, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: rjankowski.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@cla-bot cla-bot bot removed the cla:yes label May 7, 2020
@cla-bot
Copy link

cla-bot bot commented May 7, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: rjankowski.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@cla-bot
Copy link

cla-bot bot commented May 7, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: rjankowski.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@Raalsky Raalsky force-pushed the warn-nothing-selected branch 2 times, most recently from 59b6720 to 3d0770b Compare May 7, 2020 15:32
@cla-bot cla-bot bot added the cla:yes label May 7, 2020
@Raalsky Raalsky changed the title WIP: Added warning to nodes selector if nothing was matched Added warning to nodes selector if nothing was matched May 7, 2020
@Raalsky
Copy link
Contributor Author

Raalsky commented May 7, 2020

Hi @beckjake. I've applied your suggestions and perform some refactors 😉 Feel free to reach out if you have any questions

Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, one little spelling-related nit and I can kick off the full test suite.

core/dbt/graph/selector.py Outdated Show resolved Hide resolved
core/dbt/graph/selector.py Show resolved Hide resolved
Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'll kick off the test suite and then we'll get this merged for 0.17.0

@beckjake beckjake merged commit 445543e into dbt-labs:dev/octavius-catto May 7, 2020
@Raalsky Raalsky deleted the warn-nothing-selected branch May 7, 2020 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning should be surfaced if any part of the --models specification doesn't exist
3 participants